package com.sitanyun.merchant.guide.frament.presenter.impl;

import com.sitanyun.merchant.guide.frament.model.impl.RealNameAModelImpl;
import com.sitanyun.merchant.guide.frament.model.inter.IRealNameAModel;
import com.sitanyun.merchant.guide.frament.presenter.inter.IRealNameAPresenter;
import com.sitanyun.merchant.guide.frament.view.inter.IRealNameAView;
import com.sitanyun.merchant.guide.presenter.callback.CallBack;

public class RealNameAPresenterImpl implements IRealNameAPresenter {
    private IRealNameAView mIRealNameAView;
    private IRealNameAModel mIRealNameAModel;

    public RealNameAPresenterImpl(IRealNameAView aIRealNameAView) {
        mIRealNameAView = aIRealNameAView;
        mIRealNameAModel = new RealNameAModelImpl();
    }

    @Override
    public void setrealname(String staffId, String name, String idNum, String idPicFront, String idPicBack) {
        mIRealNameAModel.setrealname(staffId, name, idNum, idPicFront, idPicBack, new CallBack() {
            @Override
            public void onSuccess(Object response) {
                mIRealNameAView.response(response,IRealNameAView.RESPONSE_ONE);
            }

            @Override
            public void onError(Throwable t) {
                mIRealNameAView.response(t,IRealNameAView.RESPONSE_TWO);
            }
        });
    }

    @Override
    public void getaccountIdentity(String individualId, String realname, String certNo) {
        mIRealNameAModel.setaccountIdentity(individualId, realname, certNo, new CallBack() {
            @Override
            public void onSuccess(Object response) {
                mIRealNameAView.responseaccountIdentity(response,IRealNameAView.RESPONSE_ONE);
            }

            @Override
            public void onError(Throwable t) {
                mIRealNameAView.responseaccountIdentity(t,IRealNameAView.RESPONSE_TWO);
            }
        });
    }

    @Override
    public <T> void getuserSign(String individualId, String accountId) {
        mIRealNameAModel.setuserSign(individualId, accountId, new CallBack() {
            @Override
            public void onSuccess(Object response) {
                mIRealNameAView.responseuserSign(response,IRealNameAView.RESPONSE_ONE);
            }

            @Override
            public void onError(Throwable t) {
                mIRealNameAView.responseuserSign(t,IRealNameAView.RESPONSE_TWO);
            }
        });
    }
}
